﻿using System;

namespace Padsurface.Audio.Engine
{
    public class BeatsPerMinuteCalculator
    {
        private const int SecondsPerMinute = 60;

        public static double GetBeat(TimeSpan currenTime, double beatsPerMinute)
        {
            var beatsPerSecond = (beatsPerMinute / SecondsPerMinute);

            return GetBeat(currenTime.TotalSeconds, beatsPerSecond); ;
        }

        public static double GetBeat(double totalSeconds, double beatsPerSecond)
        {
            return (totalSeconds * beatsPerSecond);
        }

        public static double GetBeatsPerSecond(double beatsPerMinute)
        {
            return (beatsPerMinute / SecondsPerMinute);
        }

        public static double GetBeatsPerMinute(double beatsPerSecond)
        {
            return (beatsPerSecond * SecondsPerMinute);
        }
    }
}
